/*
 *  scripting_context.h
 *  wonderland-project
 *
 *  Created by Ben Nolan on 14/10/08.
 *  Copyright 2008 Nolan Consulting Limited. All rights reserved.
 *
 */

#pragma once

#include <v8.h>
#include <string>

namespace Wonderland{
  class ScriptingContext{
    public:
      ScriptingContext();

      void setGlobal(std::string, v8::Handle<v8::Value>);
      bool loadAndEvaluate(std::string);
      std::string evaluate(std::string js);
      
      v8::Handle<v8::ObjectTemplate> getGlobal(){
        return global_;
      }
      v8::Persistent<v8::Context> getContext(){
        return context_;
      }

    protected:
      v8::HandleScope handle_scope;

    private:
      
      v8::Handle<v8::ObjectTemplate> global_;
      v8::Persistent<v8::Context> context_;
    
  };
}